fix: improve error handling — stop silently swallowing errors - #1
Closed
devin-ai-integration[bot] wants to merge 1 commit into
Closed
fix: improve error handling — stop silently swallowing errors#1devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
- Add debug logging to all catch blocks that previously used catch(_){}
or catch(_) with no logging, across 14 files
- vocpass_auth_service: handleTokenLogin now rethrows on failure so
callers can react; restoreSession returns bool success status
- app.dart: wrap deep-link token login in try/catch since it now throws
- w2m_result_screen: filter out unparseable dates instead of silently
substituting DateTime.now()
- restaurant_screen: surface menu load errors in the UI (_menuError)
- following_screen: log profile fetch failures instead of empty catch
- forum_verification_sheet: log refreshMe() failures
- forum_service/forum_screen: log fetchAdminInfo and fetchTags failures
- api_service: log curriculum fetch failure in fetchAttendanceWithCurriculum
- All screen-level catch blocks (score, exam_score, curriculum,
attendance, home) now log the original error for debugging while
still showing user-friendly messages
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Audited all
catchblocks across the codebase and fixed cases where errors were silently swallowed or lost.Errors now rethrown to callers:
VocPassAuthService.handleTokenLogin— previously caught the error, cleared the token, and returned silently. Now rethrows so callers (deep link handler) know login failed. The_handleTokenLoginAndSyncNotifyinapp.dartcatches and logs the rethrown error.VocPassAuthService.restoreSession— changedFuture<void>→Future<bool>to indicate success/failure. Existing callers thatawaitit are unaffected.Silent data corruption fixed:
_W2MEditSheetdate parsing:catch (_) { return DateTime.now(); }silently substituted today's date for unparseable strings. Now returnsnulland filters with.whereType<DateTime>()— unparseable dates are dropped instead of corrupted.Silent failures now surfaced to UI:
RestaurantDetailScreen._loadMenu: added_menuErrorstate field; the menu section now shows "菜單載入失敗" on failure instead of silently hiding the error and showing the empty-state message.Debug logging added to 14 catch blocks that previously used
catch (_) {}orcatch (e)without logging — all now includeif (kDebugMode) print(...)with context:following_screen._fetchProfile,forum_verification_sheet.refreshMe(),forum_service.fetchAdminInfo,forum_screen.fetchTags,api_service.fetchAttendanceWithCurriculum(curriculum sub-fetch), and all screen-level generic-catch blocks inhome_screen,score_screen,exam_score_screen,attendance_screen,curriculum_screen.Link to Devin session: https://app.devin.ai/sessions/bd31ccf3d1444f0ab162684bed8684eb
Requested by: @HansHans135